<?php
if (! isset($_SESSION)) session_start();
    
       

$mode = isset($_REQUEST["mode"]) ?  $_REQUEST["mode"] : "";
$category  = isset($_REQUEST["category"]) ? $_REQUEST["category"] : 0;
$StudyYear  = isset($_REQUEST["StudyYear"]) ? $_REQUEST["StudyYear"] : 2011; 


$data_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/search_box/data/SubjectAreaList_{$StudyYear}_{$mode}_{$category}.json";


if (!file_exists($data_file)) {
    $feed="http://www.peterborough.ac.uk/WebServices/PRC/service.asmx/SubjectAreaList?StudyYear={$StudyYear}&mode={$mode}&category={$category}";
  

    $xml = simplexml_load_file($feed);

    file_put_contents($data_file, json_encode($xml));
    
}

echo file_get_contents($data_file);
    


?>


